﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
using GameUpTableProject.AppScreens;
using WaveEngine.Common.Math;
using WaveEngine.Components.Gestures;
using WaveEngine.Components.Graphics2D;
using WaveEngine.Components.Transitions;
using WaveEngine.Framework;
using WaveEngine.Framework.Graphics;
using WaveEngine.Framework.Physics2D;
using WaveEngine.Framework.Services;

namespace GameUpTableProject.LoginScreens
{
    public class InitialScene : Scene
    {
        protected override void CreateScene()
        {
            var imageBackground = new Entity()
                .AddComponent(new Transform2D()
                {
                    Origin = Vector2.Zero,
                    XScale = 0.5f,
                    YScale = 0.5f,
                })
                .AddComponent(new Sprite("Content/Backgrounds/ScreenIntro.wpk"))
                .AddComponent(new SpriteRenderer(DefaultLayers.Opaque))
                .AddComponent(new RectangleCollider())
                .AddComponent(new TouchGestures());

            imageBackground.FindComponent<TouchGestures>().TouchTap += LoadLogingScreen;

            EntityManager.Add(imageBackground);
        }

        void LoadLogingScreen(object sender, GestureEventArgs e)
        {
            WaveServices.ScreenContextManager.To(new ScreenContext(new MainMenuScene()), new CoverTransition(TimeSpan.FromSeconds(2), CoverTransition.EffectOptions.FromBottomRight));
        }
    }
}
